#include <iostream>
#include <stack>
#include <unordered_map>
using namespace std;

bool isValid(string s) {
    stack<char> st;
    unordered_map<char, char> map = {{')', '('}, {']', '['}, {'}', '{'}};

    for (char c : s) {
        if (map.count(c)) { 
            if (st.empty() || st.top() != map[c]) {
                return false;
            }
            st.pop();
        } else {  
            st.push(c);
        }
    }
    
    return st.empty();
}

int main() {
    string s = "{()[()]}";

    if (isValid(s)) {
        cout << "Valid" << endl;
    } else {
        cout << "Invalid" << endl;
    }
    return 0;
}